//导入封装好的axios(封装好的ajax) -request
import request from '@/utils/request'
import chapter from "../../views/edu/course/chapter";

/**
 * 定义接口
 */
export default {
  /**
   * 根据课程id获取张杰信息
   * @param courseId
   * @returns {*}
   */
  getAllSubjectVideo(courseId) {
    return request({
      // 请求地址
      url: '/edu/chapter/getChapterVideoByCourseId/' + courseId,
      method: 'get',
    })
  },
  /**
   * 添加章节信息
   * @param chapter 章节类
   * @returns {*}
   */
  addChapter(chapter) {
    return request({
      url: '/edu/chapter/addChpater',
      method: 'post',
      data: chapter
    })
  },
  /**
   * 根据章节id获取章节
   * @param chapterId
   * @returns {*}
   */
  getChapter(chapterId) {
    return request({
      url: '/edu/chapter/getChapter/' + chapterId,
      method: 'get'
    })
  },
  /**
   * 更新章节信息
   * @param chpater
   * @returns {*}
   */
  updateChapter(chapter) {
    return request({
      url: '/edu/chapter/updateChapter',
      method: 'post',
      data: chapter
    })
  },
  /**
   * 根据id删除章节
   * @param chapterId
   * @returns {*}
   */
  deleteChapter(chapterId) {
    return request({
      url: '/edu/chapter/deleteChpater/' + chapterId,
      method: 'get'
    })
  }
}
